﻿using DDD.Domain.Abstract.Entities;
using System.Linq.Expressions;

namespace DDD.Domain.Abstract.Repositories
{
    public interface IRepository<TEntity>
        where TEntity : Entity
    {
        TEntity Add(TEntity entity);

        Task<TEntity> AddAsync(TEntity entity);

        TEntity Update(TEntity entity);

        bool Delete(TEntity entity);

        IQueryable<TEntity> Query(Expression<Func<TEntity, bool>> expression);
    }


    public interface IRepository<TEntity, TKey> : IRepository<TEntity>
        where TEntity : Entity<TKey>
    {
        bool Delete(TKey id);

        TEntity Get(TKey id);

        Task<TEntity> GetAsync(TKey id);
    }
}
